package com.ruoyi.statistics.controller;

import com.ruoyi.common.annotation.Anonymous;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDept;
import com.ruoyi.common.utils.SecurityUtils;
import com.ruoyi.statistics.domain.AgentRank;
import com.ruoyi.statistics.service.ISysStatisticsAgentRankService;
import com.ruoyi.system.service.ISysDeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 代理商排行榜
 */
@RestController
@RequestMapping("/statistics/statisticsAgentRank")
public class SysStatisticsAgentRankController extends BaseController {
    @Autowired
    private ISysStatisticsAgentRankService sysStatisticsAgentRank;
    @Autowired
    private ISysDeptService sysDeptService;

    /**
     * 代理商排行榜
     * @return
     */
    @GetMapping("/getAgentRank")
    public AjaxResult getAgentRank(){
        Map<String,List<AgentRank>> map = new HashMap<>();
        List<AgentRank> spendRankDesc = sysStatisticsAgentRank.AgentRankBySpendAmountDesc();
        map.put("SpendRankDescList",spendRankDesc);

        List<AgentRank> spendRankAcs = sysStatisticsAgentRank.AgentRankBySpendAmountAsc();
        map.put("SpendRankAcsList",spendRankAcs);

        List<AgentRank> rechargeRankDescList = sysStatisticsAgentRank.AgentRankByRechargeAmountDesc();
        map.put("RechargeRankDescList",rechargeRankDescList);

        List<AgentRank> rechargeRankAcsList = sysStatisticsAgentRank.AgentRankByRechargeAmountAsc();
        map.put("RechargeRankAcsList",rechargeRankAcsList);
        return AjaxResult.success(map);
    }
}
